package com.education.ai.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 测试控制器，用于验证系统正常运行
 */
@RestController
@RequestMapping("/api/test")
public class TestController {

    @Value("${spring.datasource.url:未配置}")
    private String dbUrl;

    /**
     * 系统状态测试
     */
    @GetMapping("/status")
    public Map<String, Object> getStatus() {
        Map<String, Object> status = new HashMap<>();
        status.put("status", "运行正常");
        status.put("time", System.currentTimeMillis());
        status.put("mode", "测试模式");
        return status;
    }

    /**
     * 系统配置测试
     */
    @GetMapping("/config")
    public Map<String, Object> getConfig() {
        Map<String, Object> config = new HashMap<>();
        config.put("databaseUrl", dbUrl);
        config.put("javaVersion", System.getProperty("java.version"));
        config.put("osName", System.getProperty("os.name"));
        return config;
    }
} 